<template>
	<view class="page-scroll">
		<view class="">
			<view class="tip">根据国家要求规定，上门护理服务需进行身份</view>
			<view class="positive">
				<view class="left"></view>身份证照
			</view>
			<view class="upload-box">
				<view class="upload-item">
					<view class="upload" @click="openMessage(true)" style="
					  background: url(../../../static/img/iden/card.png);
					  background-size: 244rpx 162rpx;
					">
						<image :src="cardSrc" mode="aspectFit"></image>
						<image src="../../../static/img/iden/seal.png" mode="aspectFit" class="seal" v-if="num < 0">
						</image>
					</view>
					<view class="head"> 点击上传头像面 </view>

				</view>
				<view class="upload-item">
					<view class="upload" @click="openMessage(false)" style="
					  background: url('http://loto.oss-cn-shanghai.aliyuncs.com/email/63476986b5de4707.png');
					  background-size: 244rpx 162rpx; 
					">
						<image :src="cardSrcBack" mode="aspectFit"></image>
						<!-- <image src="../../../static/img/iden/seal.png" mode="aspectFit" class="seal" v-if="num < 0"></image> -->
					</view>
					<view class="head"> 点击上传国徽面 </view>
				</view>

			</view>



			<!-- 拍摄提示 -->
			<view class="" style="width: 100%;  box-sizing: border-box" v-if="!cardSrc">
				<view class="positive">
					<view class="left"></view>拍摄须知
				</view>
				<view class="demo">
					<view class="demo1" v-for="(item, index) in demo1" :key="index"
						style="width: 132rpx; height: 88rpx">
						<image :src="item.src" mode="aspectFit" style="width: 132rpx; height: 88rpx"></image>

						<view class="demo2"><text :style="item.style">{{ item.judge }}</text>{{ item.txt }}</view>
					</view>
				</view>
			</view>
			<view class="lose" v-else>
				<view class="loseTip">
					<view class="tanhao icon-a-qingkongpng iconfont" v-if="num > 0"></view>
					<view class="loseReason">{{
			  num > 0 ? "失败原因：您的网络信号不佳" : ""
			}}</view>
				</view>
				<view class="please">
					<view class="">请联系护士小鹿客服400-880-9120</view>
					<view class="">上班时间：工作日（9:00~17:30）</view>
				</view>
			</view>
			<!-- 紧急联系人 -->
			<view class="" style="width: 100%;  box-sizing: border-box" >
				<view class="positive">
					<view class="left"></view>
					紧急联系人
					<text style="padding-left: 24rpx; color: rgba(255, 79, 79, 1)">
						{{showUrgencyLinkman?'' :'已添加'}}
					</text>
				</view>
				<view class="px-3" v-if="showUrgencyLinkman">
					<view class="emergency-contact">
						<input type="text" value="" v-model="form.name" placeholder="请输入联系人姓名"
							placeholder-style="font-size:28rpx;color:#CCCCCC;" />
						<text v-if="form.name" @click="form.name=''" class="icon-a-qingkongpng iconfont clear"></text>
					</view>
					<view class="emergency-contact ">
						<input type="text" value="" v-model="form.mobile" placeholder="请输入联系人电话"
							placeholder-style="font-size:28rpx;color:#CCCCCC;" />
						<text class="icon-a-qingkongpng iconfont clear" v-if="form.mobile"
							@click="form.mobile=''"></text>
					</view>
					
					<radio-group class="mt-2" name="" @change="checkboxChange" v-if='contactList.length>0'>
						<view class="  " v-for="(item,index) in contactList" :key="index">
							<label class="emergency-select">
								<radio :id="item.value" :value="item.value" :checked="item.checked" color="#3C8EFF"
									style="transform:scale(0.7);color:#3C8EFF;" />
								<text class="text-primary" style="margin-left: 4rpx;">{{ item.title }}</text>
							</label>
						</view>
					</radio-group>
					<view class="tip-box mt-2">
						<view class="title">温馨提示</view>
						<view v-for="(item,index) in tips" :key="index" class="tips-item">
							{{item}}
						</view>
					</view>
				</view>


			</view>





			<!-- 身份证上传失败显示 -->


			<view class="into into1" v-if="!onData.faceJson">
				<view class="save" style="background-color: #3c8eff" @click="moveTo">下一步：人脸验证</view>
			</view>
		</view>
		<uni-popup ref="message" type="center">
			<view class="permission-bc" style="width: 540rpx;height:676rpx">
				<view style="height: 73%;"></view>
				<view @click="idCard" class="d-center" style="height: 78rpx;color: #fff;font-size: 32rpx;">马上开启</view>
				<view @click="closeMessage" class="d-center" style="height: 78rpx;font-size: 28rpx;color: #999999;">以后再说
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	import biaofunDatetimePicker from '@/components/uni-ui/biaofun-datetime-picker/biaofun-datetime-picker.vue';
	import uniConfirm from '@/components/uni-ui/uni-confirm/uni-confirm.vue'
	import uniPopup from '../../../components/uni-ui/uni-popup/uni-popup.vue';
	import uploadImage from '@/common/js/ossutil/uploadFile.js';
	import uniNumberBox from '../../../components/uni-ui/uni-number-box/uni-number-box.vue';
	import {
		validateUsername,
		validatePhone
	} from '@/common/js/validate.js';
	import {
		selectAllUrgencyLinkman
	} from '@/apis/security/index.js'
	import {
		translateapp
	} from '../../../common/js/common.js'
	import {
		idCardCheck,
		faceCheck
	} from '@/apis/nurse/index.js'
	import {
		selectNurseInfoCheckById,
		nurseCheckInfo,
		nurseAutonymAndDeail,
	} from '@/apis/certificate/certification.js'
	import {
		addUrgencyLinkman,
	} from '@/apis/security/index.js';
	import {
		debounce
	} from '@/common/js/throttle.js'
	import {
		requestAndroid
	} from '@/common/js/location.js'
	export default {
		components: {
			biaofunDatetimePicker,
			uniPopup,
			uniNumberBox,
			uniConfirm
		},
		data() {
			return {
				showUrgencyLinkman: false,
				tips: [
					"1. 紧急联系人会在您进行报警操作时同步通知紧急联系人",
					"2. 您添加完成紧急联系人后请及时告知对方您的行为，以 免造成不必要的误会",
					"3. 目前仅支持添加中国大陆手机号码",
				],
				form: {
					name: '',
					mobile: '',
					// nurseId: this.$store.state.userInfo.id, //护士ID
					type: '', //1 2 3
				},
				contactList: [{
					checked: false,
					value: '1',
					title: '每次上门护理时'
				}, {
					checked: false,
					value: '2',
					title: '仅在接夜间单（21:00-6:30)期间'
				}, {
					checked: false,
					value: '3',
					title: '暂时不用'
				}],
				status: true,
				caregiverPicture: '', //护工证
				currentDate: '',
				editStatus: 1,
				check: false,
				confirmShow: false,
				showPicker: '请选择证件截止时间',
				onType: '', //获取到的护士证书图片认证信息
				onData: {
					status: 0
				}, //判断获取到的认证信息
				bol: false, //判断身份证上传成功
				num: 0, //-1已认证 0未认证 1网络不佳
				tabIndex: 0, //tab切换判断
				tabBars: ['身份认证', '执业认证', '护工职业认证'],
				zsType: ['纸质版', '电子版'],
				cardSrc: "", //身份证正面
				cardSrcBack: "", //身份证反面
				showType: [], //v-for type列表
				popTitle: "", //popup title
				popList: '', //popup 选项列表判断
				popData: '', //popup 选中项
				hospital: '', //执业机构
				department: '', //科室
				position: '', //职称
				workingYears: '', //年限
				serviceTypeArr: "",
				data1: {
					department: '',
					expirationDate: '',
					homePicture: '', //首页
					hospital: '',
					infoPicture: '', //详情页
					nursePicture: '',
					orderPicture: '', //延续页
					position: '',
					workingYears: '',
					serviceType: "",
					departAddress: '',
					type: 0,
					nurseId: ''
				}, //职业认证提交内容
				dataType: 0,
				itemOptions: [{
					id: 6,
					value: '上门护理',
					label: '上门护理',
					checked: true
				}, {
					id: 2,
					value: '就医陪诊',
					label: '就医陪诊',
					checked: true
				}, {
					id: 4,
					value: '儿科护理',
					label: '儿科护理',
					checked: true
				}, {
					id: 8,
					value: '核酸检测',
					label: '核酸检测',
					checked: true
				}, {
					id: 3,
					value: '居家康复',
					label: '居家康复'
				}, {
					id: 5,
					value: '中医理疗',
					label: '中医理疗'
				}, {
					id: 1,
					value: '母婴护理',
					label: '母婴护理'
				}, {
					id: 7,
					value: '推拿按摩',
					label: '推拿按摩'
				}, {
					id: 9,
					value: '检测服务',
					label: '检测服务'
				}],
				type: {
					homePicture: {
						txt: '首页',
						bg: `background-image:url(../../../static/img/iden/first.png);`,
						src: '',
						src1: '',
					},
					infoPicture: {
						txt: '详情页',
						bg: `background-image:url(../../../static/img/iden/second.png);`,
						src: '',
						src1: '',
					},
					orderPicture: {
						txt: '延续页',
						bg: `background-image:url(../../../static/img/iden/third.png);`,
						src: '',
						src1: '',
					}
				},
				list: [{
						txt: '执业机构',
						pla: '请输入执业机构',
						value: '',
						value1: '',
					},
					{
						txt: '所属科室',
						pla: '请选择所属科室',
						value: '',
						value1: '',
					},
					{
						txt: '当前职称',
						pla: '请选择当前职称',
						value: '',
						value1: '',
					},
					{
						txt: '工作年限',
						pla: '请选择工作年限',
						value: '',
						value1: '',
					},
					{
						txt: '服务类目',
						pla: '请选择服务类目',
						value: "",
						value1: '',
					},
					{
						txt: '服务出发地址1',
						pla: '请选择服务出发地址',
						value: "",
						value1: '',
					},
				],
				nurse: [
					'护士',
				],
				section: [
					'全科', '医美', '母婴'
				],
				demo1: [{
						src: "../../../static/img/iden/1.png",
						style: `color: #3c8eff;`,
						judge: '√',
						txt: "标准拍摄"
					},
					{
						src: "../../../static/img/iden/4.png",
						style: `color: rgba(255, 79, 79, 1);`,
						judge: '×',
						txt: "竖向拍摄"
					},
					{
						src: "../../../static/img/iden/2.png",
						style: `color: rgba(255, 79, 79, 1);`,
						judge: '×',
						txt: "拍摄不全"
					},
					{
						src: "../../../static/img/iden/3.png",
						style: `color: rgba(255, 79, 79, 1);`,
						judge: '×',
						txt: "拍摄模糊"
					},
				],
				demo2: [{
						src: "../../../static/img/iden/notice-one.png",
						style: `color: #3c8eff;`,
						judge: '√',
						txt: "标准拍摄"
					},
					{
						src: "../../../static/img/iden/notice-two.png",
						style: `color: rgba(255, 79, 79, 1);`,
						judge: '×',
						txt: "竖向拍摄"
					},
					{
						src: "../../../static/img/iden/notice-three.png",
						style: `color: rgba(255, 79, 79, 1);`,
						judge: '×',
						txt: "拍摄不全"
					},
					{
						src: "../../../static/img/iden/notice-four.png",
						style: `color: rgba(255, 79, 79, 1);`,
						judge: '×',
						txt: "拍摄模糊"
					},
				],
				dataObj: {
					incidentName: 'nurseAutonym',
					incidentPerson: this.$store.state.userInfo.id,
					source: this.$store.state.system.brand,
				},
				result: '',
				nurseId: '',
				timeValue: '',
				loc: -1,
			}
		},
		onLoad(option) {
			this.getMision()
			this.getDataDetail()
			this.select()
			this.showType = this.type
			// 身份认证 或 执业认证方式
			if (option.type) {
				this.tabIndex = Number(option.type)
			}
			uni.$on('departAddress', res => {
				let _this = this;
				_this.list[5].value = res.myaddress;
				_this.data1.departAddress = res.myaddress;
				_this.data1.departAddressCity = res.city;
				console.log('_this.data1.departAddress000', _this.data1.departAddress)
			});
			this.getCurrentDate()


		},

		onShow() {
			let tab = -1
			try {
				tab = uni.getStorageSync('tab')
			} catch (e) {
				console.log('error777777-------', e)
			}

			if (tab == 1) {
				uni.removeStorageSync('tab')
				this.tabIndex = 1
			}
			// console.log(this.$store.state.address,this.$store.state.userInfo.attestStatus,'首页的')
			this.data1.type = this.dataType
			this.selectAllUrgencyLinkman()
			// uni.$on('nurseMechanism', res => {
			// 	let _this = this;
			// 	// console.log(res, '接收的数据是');
			// 	_this.list[0].value = res.address;
			// 	_this.data.hospital = res.address;
			// });

		},
		computed: {
			//tab切换样式
			tabStyle(index) {
				var num = this.tabIndex;
				return function(index) {
					// console.log('index',index,'num',num)
					var style;
					if (num == index) {
						return style = `width: 216rpx;
							background: rgba(255, 255, 255, 0.3);
							border: 2rpx solid rgba(255, 255, 255, 0.3);`
					} else {
						if (index == 0) {
							return style = `margin-right:-14rpx`
						} else {
							return style = `margin-left:-14rpx`
						}
					}
				}
			},
			//年限
			year() {
				let arr = ['大于20年']
				for (let i = 20; i > 0; i--) {
					arr.unshift(i + '年')
				}
				return arr
			},
		},
		watch: {
			tabIndex(newValue, oldValue) {
				let title = newValue == 0 ? '身份认证' : '职业资格认证'
				uni.setNavigationBarTitle({
					title: title
				})
			}
		},
		onUnload() {
			this.dataObj.incidentName = 'returnNurseAutonym'
			this.getDataDetail()
		},
		
		methods: {
			async selectAllUrgencyLinkman() {
				let res = await selectAllUrgencyLinkman()
				console.log("是否有",res)
				if (!res.object || res.object.length == 0) {
					this.showUrgencyLinkman = true
					return
				}
			},
			save: debounce(async function() {
				if (!this.$store.state.userInfo) {
					uni.showModal({
						confirmColor: '#3c8eff',
						success(res) {
							if (res.confirm) {
								uni.navigateTo({
									url: '/pages/login-register/login/login'
								})
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					})
					return
				}
				// 验证联系人姓名
				if (validateUsername(this.form.name) && validatePhone(this.form.mobile, 86)) {
					console.log(this.form);
					if (!this.form.type) {
						plus.nativeUI.toast('请选择何时发送短信')

						return
					}
					let res = await addUrgencyLinkman(this.form)
					console.log('编辑紧急联系人', this.form)
					if (res.success) {
						plus.nativeUI.toast('联系人提交成功')
						this.$store.commit('setContactList', true)
						setTimeout(() => {
							if (this.num < 0) {
								// #ifdef APP-PLUS
								plus.nativeUI.toast('您已进行过身份验证！')
								// #endif
								// uni.showToast({
								// 	icon:'none',
								// 	title:'您已进行过身份验证！'
								// })
								setTimeout(() => {
									uni.navigateBack({
										delta: 1
									})
									uni.navigateTo({
										url: '../iden/careerChoice'
									})
								})
							} else {
								this.gofaceVeri()
							}
						}, 300)

					}
				}
			}, 2000, true),
			openMessage(status) {
				this.status = status
				let that = this
				this.getMision()
				if (this.loc == -1) {
					that.$refs.message.open()
				} else {
					that.idCard()
				}
			},
			closeMessage() {
				this.$refs.message.close()
			},
			async getMision() {
				if (uni.getSystemInfoSync().platform == 'android') {
					// 安卓权限查询
					this.loc = await permision.checkAndroidSelfPermission(
						'android.permission.WRITE_EXTERNAL_STORAGE'
					)
					console.log('anzhuo', this.loc)
				}
			},
			async getDataDetail() {
				let ress = uni.getSystemInfoSync()
				this.dataObj.source = ress.uniPlatform
				console.log('详情页统计数据', this.dataObj);
				let res = await nurseAutonymAndDeail(this.dataObj)
				if (res.success) {}
			},
			//上传护工照片
			async idCareCard() {
				let res = await this.upLoad()
				this.caregiverPicture = res
				console.log(res, '护工证');
			},
			getCurrentDate() {
				var date = new Date()
				var day = date.getDate() + 1
				var year = date.getFullYear();
				var month = date.getMonth() + 1;
				month = (month > 9) ? month : ("0" + month);
				day = (day < 10) ? ("0" + day) : day;
				this.currentDate = year + "-" + month + "-" + day;
			},
			tabChange(index) {
				this.tabIndex = index
				this.data1.type = 0
			},
			//身份证上传
			async idCard() {
				if (this.loc == -1) {
					this.closeMessage()
				}
				this.loc = 1
				if (this.num < 0) {
					// #ifdef APP-PLUS
					plus.nativeUI.toast('您已完成实名验证')
					uni.navigateTo({
						url: '../iden/careerChoice'
					})
					// #endif
				} else {
					let res = await this.upLoad()
					if (res) {
						if (this.status) {
							this.cardSrc = res
						} else {
							this.cardSrcBack = res
						}
						console.log('111111', this.cardSrc)
						this.num = 0
						// #ifdef APP-PLUS
						plus.nativeUI.toast('上传成功')
						// #endif
					} else {
						this.num = 1
					}
				}

			},
			//认证时未定位跳转定位
			bindBtn(type) {
				if (type == 'confirm') {
					uni.navigateTo({
						url: '../../address/select-address/select-address?atte=true'
					})
				} else {
					uni.navigateBack({
						delta: 1
					})
				}
			},
			//跳转人脸验证
			async moveTo() {
				if (!this.cardSrc || !this.cardSrcBack) {
					// #ifdef APP-PLUS
					plus.nativeUI.toast('请完整身份证正面照')
					// #endif
					// uni.showToast({
					// 	icon:'none',
					// 	title:'请上传身份证正面照'
					// })
					return
				}
				if(this.showUrgencyLinkman) {
					this.save()
				} else {
					this.gofaceVeri()
				}
				

			},
			gofaceVeri() {
				let card = {
					cardSrc: this.cardSrc,
					cardSrcBack: this.cardSrcBack,
					
				}
				uni.navigateTo({
					url: "../face-veri/face-veri?data=" + encodeURIComponent(JSON.stringify(card))
				})
			},
			//职业认证上传护士资格证书
			async nurseFirst() {
				if (this.onData.status == 1 && this.onData.status == 2) {
					this.remind()
				} else {
					let res = await this.upLoad()
					console.log(res, '首页')
					this.data1.nursePicture = res
					console.log(this.data1.nursePicture, '首页')
				}

			},
			//证书类型下的三张图片
			async nursePicture(item) {
				if (this.onData.status == 1 && this.onData.status == 2) {
					this.remind()
				} else {
					let res = await this.upLoad()
					item.src = res
				}

			},
			
			formatDate(d) {
				var date = new Date(d);
				var YY = date.getFullYear() + '-';
				var MM =
					(date.getMonth() + 1 < 10 ?
						'0' + (date.getMonth() + 1) :
						date.getMonth() + 1) + '-';
				var DD = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
				var hh =
					(date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
				var mm =
					(date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) +
					':';
				var ss =
					date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
				return YY + MM + DD + ' ' + hh + mm + ss;
			},

			//选择证件时间
			changeDatetimePicker(date) {
				this.timeValue = this.formatDate(date.dt)
				console.log('expirationDate', this.data1.expirationDate)
			},
			//证书类型选择
			typeChange(index) {
				this.dataType = index
				this.data1.type = index
				if (index == 0) {
					this.showType = this.type
				} else if (index == 1) {
					delete this.data1.homePicture
					delete this.data1.orderPicture
					this.showType = {}
					this.showType.infoPicture = this.type.infoPicture
				}
				console.log(this.data1.type, index)
			},
			//其他信息列表
			change(index) {
				if (this.onData.status == 2 || this.onData.status == 1) {
					this.remind()
				} else {
					switch (index) {
						case 0:
							// uni.navigateTo({
							// 	url: '../../address/select-address/select-address?type=nurse'
							// })
							break;
						case 1:
							this.$refs.popup.open()
							this.popTitle = "选择所属科室"
							this.popList = 1
							break;
						case 2:
							this.$refs.popup.open()
							this.popTitle = "选择当前职称"
							this.popList = 2
							break;
						case 3:
							this.$refs.popup.open()
							this.popTitle = "选择工作年限"
							this.popList = 3
							break;
						case 4:
							this.$refs.popup.open()
							this.popTitle = "选择服务类目"
							this.popList = 4
							break;
						case 5:
							uni.navigateTo({
								url: '../../address/input-address/index?type=departAddress'
							})
							break;
					}
				}
			},
			checkboxChange(e) {
				this.form.type = Number(e.detail.value)
			},
			//年限选择
			
			//取消按钮 关闭 popup
			popDel() {
				this.$refs.popup.close()
			},
			//popup 确定按钮
			confirm() {
				if (this.popList == 1) {
					this.list[1].value = this.data1.department
				} else if (this.popList == 2) {
					this.list[2].value = this.data1.position
				} else if (this.popList == 3) {
					this.list[3].value = this.data1.workingYears
				} else if (this.popList == 4) {
					this.serviceTypeArr = []
					this.itemOptions.map(m => {
						if (m.checked) {
							this.serviceTypeArr.push(m.value)
						}
					})
					this.list[4].value = this.serviceTypeArr.join(",")
					this.data1.serviceType = this.serviceTypeArr.join(",")
				}
				this.$refs.popup.close()
			},
			// 更新认证信息
			async updateInfo(nurseId) {
				if (this.onData.subStatus == 1) {
					uni.showToast({
						icon: 'none',
						title: '您的护士资格认证正在审核中，请勿重复认证！'
					})
				} else {
					this.tabIndex = 1
					this.onData.status = 0
					this.data1.type = 0
					this.editStatus = 0
					this.$forceUpdate()
				}
			},

			//查询护士认证信息
			async select() {
				let id = this.$store.state.userInfo.id
				let res = await selectNurseInfoCheckById({
					id
				})
				// console.log('护士信息', res)
				if (res.success) {
					this.onData = res.object
					this.nurseId = this.onData.nurseId

					if (res.object.idcardJson) {
						this.num = -1
						this.cardSrc = res.object.idcardJson
					}
					// // 已拒绝
					// if (res.object.status == 3) {
					// 	// #ifdef APP-PLUS
					// 	plus.nativeUI.toast('您的职业认证未通过，请再次填写提交')
					// 	// #endif
					// 	return
					// }

					this.data1 = res.object
					this.data1.type = res.object.type

					this.list[0].value = res.object.hospital
					this.list[1].value = res.object.department
					this.list[2].value = res.object.position
					this.list[3].value = res.object.workingYears
					this.list[4].value = res.object.serviceType
					this.list[5].value = res.object.departAddress
					this.type.infoPicture.src = res.object.infoPicture
					if (res.object.orderPicture || res.object.homePicture) {
						this.type.orderPicture.src = res.object.orderPicture
						this.type.homePicture.src = res.object.homePicture
					}
					// if (res.object.status == 3) {
					// 	for (k in this.data1) {
					// 		if (!this.data1[k]) {
					// 			delete this.data1[k]
					// 		}
					// 	}
					// 	if (!res.object.homePicture) {
					// 		this.dataType = 1
					// 		this.typeChange(1)
					// 	}
					// 	if (res.object.expirationDate) {
					// 		this.showPicker = res.object.expirationDate
					// 	}

					// }

				}


			},
			//已认证进行的提示
			remind() {
				if (this.onData.subStatus == 1) {
					// #ifdef APP-PLUS
					plus.nativeUI.toast('您的护士资格认证正在审核中，请勿重复认证！')
					// #endif
					// uni.showToast({
					// 	icon:'none',
					// 	title:'您的护士资格认证正在审核中，请勿重复认证！'
					// })
				} else if (this.onData.subStatus == 3) {
					// #ifdef APP-PLUS
					plus.nativeUI.toast('您的护士资格认证未通过，请重新认证!')
					// #endif
					// uni.showToast({
					// 	icon:'none',
					// 	title:'你已进行过护士资格认证，请勿重复认证！'
					// })
				}

			},
			//上传
			upLoad() {
				return new Promise((resolve, reject) => {
					let _this = this
					uni.chooseImage({
						count: 1, //默认9
						sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
						sourceType: ['album', 'camera'], //从相册选择 拍照
						success: function(res) {
							// console.log(res.tempFiles[0].size, '图片尺寸大小是---');
							translateapp(res.tempFilePaths[0], 80, imgUrl => {
								//打印压缩后返回的图片url
								// console.log(imgUrl, '压缩后的路径')
								uploadImage(imgUrl, 'idCardNurse/',
									result => {
										resolve(result)
									}, error => {
										reject(error)
										// #ifdef APP-PLUS
										plus.nativeUI.toast('上传失败')
										// #endif
									})
							})
						},
						fail(e) {
							if (e.errCode == 11) {
								requestAndroid('android.permission.CAMERA', '摄像头')
							}
						}
					})
				})
			},
			nurseNeed() {
				uni.navigateTo({
					url: './flow'
				})
			},
		}
	}
</script>

<style scoped lang="less">
	.page-scroll {
		overflow-y: auto;
		// overflow-x: hidden;
	}

	.tip-box {
		padding: 32rpx;
		padding-bottom: 16rpx;
		margin-bottom: 200rpx;
		border-radius: 24rpx;
		background: #F9FAFB;

		.title {
			font-size: 28rpx;
			font-weight: 500;
			line-height: 42rpx;
			margin-bottom: 24rpx;
			color: #000000;
		}

		.tips-item {
			font-size: 24rpx;
			line-height: 36rpx;
			margin-bottom: 16rpx;
			color: #6B7280;
		}
	}

	.emergency-contact {
		margin-top: 32rpx;
		border-radius: 24rpx;
		background: #F9FAFB;
		padding: 24rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.emergency-select {
		padding: 12rpx 0;
		display: flex;
		align-items: center;
	}

	.update-btn1 {
		height: 40%;
		padding-bottom: 2%;
	}

	.update-btn {
		margin-top: 10%;
		background-color: #508ff6;
		width: 50%;
		height: 90rpx;
		color: #fff;
		font-size: 32rpx;
	}

	.table {
		width: 750rpx;
		height: 108rpx;
		background: #3c8eff;
		display: flex;
		align-items: center;
		padding-left: 24rpx;
		box-sizing: border-box;
	}

	.table view {
		width: 216rpx;
		height: 76rpx;
		border-radius: 38rpx;
		color: #ffffff;
		line-height: 76rpx;
		text-align: center;
		// transition: all 1s;
	}

	.tip {
		width: 100%;
		height: 72rpx;
		background: rgba(255, 106, 0, 0.1);
		// opacity: 0.1;
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #ff6a00;
		line-height: 72rpx;
		text-align: center;
	}

	.upload-box {
		display: flex;
	}

	.upload-item {
		flex: 1;
	}

	.upload {
		width: 244rpx;
		height: 162rpx;
		margin: 50rpx auto;
		text-align: center;
		background-size: 244rpx 162rpx;
		position: relative;

		.seal {
			width: 128rpx;
			height: 128rpx;
			position: absolute;
			right: 0;
			bottom: -50rpx;
		}
	}

	.upload image {
		width: 244rpx;
		height: 162rpx;
		vertical-align: middle;
		margin-bottom: 48rpx;
	}

	.time {
		width: 90%;
		margin: 0 auto;
		display: flex;
		height: 100rpx;
		align-items: center;
		color: #040506;
		border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);

		.other {
			text-align: right;
			padding-left: 20rpx;
			overflow: hidden;
			white-space: nowrap;
			text-overflow: ellipsis;
			color: #333333;
		}
	}

	.time:active {
		opacity: 0.8;
	}

	.name {
		flex-shrink: 0;
	}

	.value {
		flex: 1;
	}

	.time image {
		width: 48rpx;
		height: 48rpx;
	}

	.zsType {
		justify-content: space-between;
	}

	.type {
		width: 304rpx;
		height: 64rpx;
		display: flex;
		justify-content: space-between;

		.dui {
			width: 20rpx;
			height: 20rpx;
			border-radius: 12rpx 0rpx 12rpx 0rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			background-color: #3c8eff;
			position: absolute;
			right: 0;
			bottom: 0;
			box-sizing: border-box;
		}
	}

	.type1 {
		width: 144rpx;
		height: 64rpx;
		border-radius: 16rpx;
		color: rgba(0, 0, 0, 0.38);
		text-align: center;
		line-height: 64rpx;
		border: 2rpx solid rgba(0, 0, 0, 0.1);
	}

	.type2 {
		border: 2rpx solid #3c8eff;
		color: #3c8eff;
		background: #ffffff;
	}

	.pop {
		width: 540rpx;
		height: 620rpx;
		background: #ffffff;
		border-radius: 12rpx;
		position: relative;
	}

	.popTitle {
		width: 540rpx;
		height: 90rpx;
		border-bottom: 1rpx solid #e5e5e5;
		line-height: 90rpx;
		text-align: center;
		font-weight: 400;
		color: #333333;
		font-size: 32rpx;
		box-sizing: border-box;
	}

	.confirm {
		height: 88rpx;
		display: flex;
		overflow: hidden;
		box-sizing: border-box;
		border-top: #e5e5e5 1rpx solid;
		position: absolute;
		left: 0;
		bottom: 0;
	}

	.confirm view {
		width: 270rpx;
		height: 88rpx;
		text-align: center;
		line-height: 88rpx;
		font-size: 32rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #333333;
		box-sizing: border-box;
	}

	.positive {
		width: 698rpx;
		height: 108rpx;
		background: #ffffff;
		display: flex;
		align-items: center;
		box-sizing: border-box;
		border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
		margin: 0 auto;
		font-size: 32rpx;
		font-family: PingFangSC-Medium, PingFang SC;
		font-weight: 500;
		color: rgba(0, 0, 0, 0.87);

		.left {
			width: 8rpx;
			height: 40rpx;
			background: #3c8eff;
			border-radius: 4rpx;
			margin-right: 16rpx;
		}
	}

	.head {
		width: 100%;
		height: 40rpx;
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #666666;
		line-height: 40rpx;
		text-align: center;
		margin-bottom: 40rpx;
	}

	.demo {
		padding-top: 58rpx;
		height: 234rpx;
		width: 100%;
		padding-left: 26rpx;
		padding-right: 36rpx;
		display: flex;
		justify-content: space-between;
		box-sizing: border-box;

		// margin-bottom: 190rpx;
		.demo1 {
			image {
				width: 120rpx;
				height: 120rpx;
			}

			.demo2 {
				width: 120rpx;
				height: 34rpx;
				font-size: 24rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #354052;
				line-height: 34rpx;
			}
		}
	}

	.lose {
		width: 100%;
		box-sizing: border-box;
		padding-left: 28rpx;
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: rgba(0, 0, 0, 0.38);

		// margin-top: 72rpx;
		.loseTip {
			width: 500rpx;
			height: 40rpx;
			display: flex;
			align-items: center;

			.tanhao {
				width: 20rpx;
				height: 20rpx;
				text-align: center;
				line-height: 20rpx;
				background-color: #0055ff;
				margin-right: 10rpx;
			}

			.loseReason {
				width: 364rpx;
				height: 40rpx;
				font-size: 28rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: rgba(0, 0, 0, 0.38);
				line-height: 40rpx;
			}
		}

		.please {
			width: 698rpx;
			height: 112rpx;
			margin-top: 16rpx;
			background: #fafafb;
			padding-left: 32rpx;
			padding-top: 16rpx;
			box-sizing: border-box;
		}
	}

	.into1 {
		margin-top: 190rpx;
		position: fixed;
		bottom: 0;
		left: 0;
		background-color: #fff !important;
		// border: 1px solid red;
	}

	.permission-bc {
		background-image: url('http://loto.oss-cn-shanghai.aliyuncs.com/email/5b089870931e40cd.png');
		background-size: 100%;
		background-repeat: no-repeat;
	}

	.year {}

	.into {
		width: 100%;
		height: 144rpx;
		background: rgba(216, 216, 216, 0);
		display: flex;
		justify-content: space-around;
		align-items: center;
		margin-top: 42rpx;
		box-shadow: 0rpx -6rpx 8rpx 0rpx rgba(0, 0, 0, 0.03);

		&.myinto {
			justify-content: flex-start;
		}

		.save {
			width: 698rpx;
			height: 96rpx;
			line-height: 96rpx;
			text-align: center;
			background: #3c8eff;
			border-radius: 8rpx;
			font-size: 36rpx;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 500;
			color: #ffffff;
		}
	}
</style>